home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / shmem_collect.z / shmem_collect
Encoding:
Text File  |  2002-10-03  |  16.9 KB  |  196 lines

  1.  
  2. SHMEM_COLLECT(3)                                           SHMEM_COLLECT(3)
  3.  
  4.  
  5. NNNNAAAAMMMMEEEE
  6.      sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt4444, sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt8888, sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt33332222, sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt66664444,
  7.      sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt, sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt4444, sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt8888, sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt33332222,
  8.      sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt66664444 - Concatenates blocks of data from multiple
  9.      processing elements (PEs) to an array in every PE
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      C or C++:
  13.  
  14.         ####iiiinnnncccclllluuuuddddeeee <<<<mmmmpppppppp////sssshhhhmmmmeeeemmmm....hhhh>>>>
  15.  
  16.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt33332222((((vvvvooooiiiidddd ****_t_a_r_g_e_t,,,, ccccoooonnnnsssstttt vvvvooooiiiidddd ****_s_o_u_r_c_e,,,, ssssiiiizzzzeeee____tttt
  17.         _n_l_o_n_g,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,, lllloooonnnngggg ****_p_S_y_n_c))));;;;
  18.  
  19.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt66664444((((vvvvooooiiiidddd ****_t_a_r_g_e_t,,,, ccccoooonnnnsssstttt vvvvooooiiiidddd ****_s_o_u_r_c_e,,,, ssssiiiizzzzeeee____tttt
  20.         _n_l_o_n_g,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,, lllloooonnnngggg ****_p_S_y_n_c))));;;;
  21.  
  22.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt33332222((((vvvvooooiiiidddd ****_t_a_r_g_e_t,,,, ccccoooonnnnsssstttt vvvvooooiiiidddd ****_s_o_u_r_c_e,,,, ssssiiiizzzzeeee____tttt
  23.         _n_l_o_n_g,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,, lllloooonnnngggg ****_p_S_y_n_c))));;;;
  24.  
  25.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt66664444((((vvvvooooiiiidddd ****_t_a_r_g_e_t,,,, ccccoooonnnnsssstttt vvvvooooiiiidddd ****_s_o_u_r_c_e,,,, ssssiiiizzzzeeee____tttt
  26.         _n_l_o_n_g,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,, lllloooonnnngggg ****_p_S_y_n_c))));;;;
  27.  
  28.      Fortran:
  29.  
  30.         IIIINNNNCCCCLLLLUUUUDDDDEEEE """"mmmmpppppppp////sssshhhhmmmmeeeemmmm....ffffhhhh""""
  31.  
  32.         IIIINNNNTTTTEEEEGGGGEEEERRRR _n_l_o_n_g
  33.         IIIINNNNTTTTEEEEGGGGEEEERRRR _P_E__s_t_a_r_t,,,, _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e
  34.         IIIINNNNTTTTEEEEGGGGEEEERRRR _p_S_y_n_c((((SSSSHHHHMMMMEEEEMMMM____CCCCOOOOLLLLLLLLEEEECCCCTTTT____SSSSYYYYNNNNCCCC____SSSSIIIIZZZZEEEE))))
  35.  
  36.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____CCCCOOOOLLLLLLLLEEEECCCCTTTT4444((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_l_o_n_g,,,, _P_E__s_t_a_r_t,,,, _l_o_g_P_E__s_t_r_i_d_e,,,,
  37.         _P_E__s_i_z_e,,,, _p_S_y_n_c))))
  38.  
  39.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____CCCCOOOOLLLLLLLLEEEECCCCTTTT8888((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_l_o_n_g,,,, _P_E__s_t_a_r_t,,,, _l_o_g_P_E__s_t_r_i_d_e,,,,
  40.         _P_E__s_i_z_e,,,, _p_S_y_n_c))))
  41.  
  42.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____FFFFCCCCOOOOLLLLLLLLEEEECCCCTTTT4444((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_l_o_n_g,,,, _P_E__s_t_a_r_t,,,, _l_o_g_P_E__s_t_r_i_d_e,,,,
  43.         _P_E__s_i_z_e,,,, _p_S_y_n_c))))
  44.  
  45.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____FFFFCCCCOOOOLLLLLLLLEEEECCCCTTTT8888((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_l_o_n_g,,,, _P_E__s_t_a_r_t,,,, _l_o_g_P_E__s_t_r_i_d_e,,,,
  46.         _P_E__s_i_z_e,,,, _p_S_y_n_c))))
  47.  
  48. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  49.      The shared memory (SHMEM) collective routines concatenate _n_l_o_n_g 64- or
  50.      32-bit data items from the source array into the target array, over
  51.      the set of PEs defined by _P_E__s_t_a_r_t, _l_o_g_2_P_E__s_t_r_i_d_e, and _P_E__s_i_z_e, in
  52.      processor number order.  The resultant target array contains the
  53.      contribution from PE _P_E__s_t_a_r_t first, then the contribution from PE
  54.      _P_E__s_t_a_r_t + _P_E__s_t_r_i_d_e second, and so on.  The collected result is
  55.      written to the target array for all PEs in the active set.
  56.  
  57.      The resulting target array is as follows:
  58.  
  59.           ----------------------------------------------------------
  60.              source(1.._n_l_o_n_g))))
  61.                  ffffrrrroooommmm PPPPEEEE ((((_P_E__s_t_a_r_t ++++ 0000 **** ((((2222********_l_o_g_P_E__s_t_r_i_d_e))))))))
  62.           ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  63.              ssssoooouuuurrrrcccceeee((((1111........_n_l_o_n_g))))
  64.                  ffffrrrroooommmm PPPPEEEE ((((_P_E__s_t_a_r_t ++++ 1111 **** ((((2222********_l_o_g_P_E__s_t_r_i_d_e))))))))
  65.           ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  66.              ............
  67.           ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  68.              ssssoooouuuurrrrcccceeee((((1111........_n_l_o_n_g))))   ffffrrrroooommmm
  69.                  PPPPEEEE ((((_P_E__s_t_a_r_t ++++ ((((_P_E__s_i_z_e ---- 1111)))) **** ((((2222********_l_o_g_P_E__s_t_r_i_d_e))))))))
  70.           ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  71.  
  72.      As with all SHMEM collective routines, each of these routines assumes
  73.      that only PEs in the active set call the routine.  If a PE not in the
  74.      active set calls a SHMEM collective routine, undefined behavior
  75.      results.
  76.  
  77.      The arguments are as follows:
  78.  
  79.      _t_a_r_g_e_t       A symmetric array.  The _t_a_r_g_e_t argument must be large
  80.                   enough to accept the concatenation of the source arrays
  81.                   on all PEs.  The data types are as follows:
  82.  
  83.                   * For sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt8888, sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt66664444, sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt8888,
  84.                     and sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt66664444, any data type with an element
  85.                     size of 64 bits.  Fortran derived types, Fortran
  86.                     character type, and C/C++ structures are not permitted.
  87.  
  88.                   * For sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt4444, sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt33332222, sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt4444,
  89.                     and sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt33332222, any data type with an element
  90.                     size of 32 bits.  Fortran derived types, Fortran
  91.                     character type, and C/C++ structures are not permitted.
  92.  
  93.      _s_o_u_r_c_e       A symmetric data object that can be of any type
  94.                   permissible for the _t_a_r_g_e_t argument.
  95.  
  96.      _n_l_o_n_g        The number of elements in the source array.  _n_l_o_n_g must
  97.                   be of type integer.  If you are using Fortran, it must be
  98.                   a default integer value.
  99.  
  100.                   The _n_l_o_n_g argument must be equal on all PEs for
  101.                   sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt8888, sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt66664444, sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt8888,
  102.                   sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt33332222, and sssshhhhmmmmeeeemmmm____ffffccccoooolllllllleeeecccctttt66664444.  The _n_l_o_n_g
  103.                   argument can be different across PEs for sssshhhhmmmmeeeemmmm____ccccoooolllllllleeeecccctttt33332222.
  104.  
  105.      _P_E__s_t_a_r_t     The lowest virtual PE number of the active set of PEs.
  106.                   _P_E__s_t_a_r_t must be of type integer.  If you are using
  107.                   Fortran, it must be a default integer value.
  108.  
  109.      _l_o_g_P_E__s_t_r_i_d_e The log (base 2) of the stride between consecutive
  110.                   virtual PE numbers in the active set.  _l_o_g_P_E__s_t_r_i_d_e must
  111.                   be of type integer.  If you are using Fortran, it must be
  112.                   a default integer value.
  113.  
  114.      _P_E__s_i_z_e      The number of PEs in the active set.  _P_E__s_i_z_e must be of
  115.                   type integer.  If you are using Fortran, it must be a
  116.                   default integer value.
  117.  
  118.      _p_S_y_n_c        A symmetric work array.
  119.  
  120.                   In C/C++, _p_S_y_n_c must be of type iiiinnnntttt and size
  121.                   ____SSSSHHHHMMMMEEEEMMMM____CCCCOOOOLLLLLLLLEEEECCCCTTTT____SSSSYYYYNNNNCCCC____SSSSIIIIZZZZEEEE.
  122.  
  123.                   In Fortran, _p_S_y_n_c must be of type integer and size
  124.                   SSSSHHHHMMMMEEEEMMMM____CCCCOOOOLLLLLLLLEEEECCCCTTTT____SSSSYYYYNNNNCCCC____SSSSIIIIZZZZEEEE.  If you are using Fortran, it
  125.                   must be a default integer value.
  126.  
  127.                   Every element of this array must be initialized with the
  128.                   value ____SSSSHHHHMMMMEEEEMMMM____SSSSYYYYNNNNCCCC____VVVVAAAALLLLUUUUEEEE in C/C++ or SSSSHHHHMMMMEEEEMMMM____SSSSYYYYNNNNCCCC____VVVVAAAALLLLUUUUEEEE in
  129.                   Fortran before any of the PEs in the active set enter
  130.                   sssshhhhmmmmeeeemmmm____bbbbaaaarrrrrrrriiiieeeerrrr().
  131.  
  132.      The values of arguments _P_E__s_t_a_r_t, _l_o_g_P_E__s_t_r_i_d_e, and _P_E__s_i_z_e must be
  133.      equal on all PEs in the active set.  The same target and source arrays
  134.      and the same _p_S_y_n_c work array must be passed to all PEs in the active
  135.      set.
  136.  
  137.      Upon return from a collective routine, the following are true for the
  138.      local PE:
  139.  
  140.      * The target array is updated.
  141.  
  142.      * The data cache region that is mapped to the target data object is
  143.        coherent in all receiving PEs.
  144.  
  145.      * The values in the _p_S_y_n_c array are restored to the original values.
  146.  
  147. NNNNOOOOTTTTEEEESSSS
  148.      The terms _c_o_l_l_e_c_t_i_v_e and _s_y_m_m_e_t_r_i_c are defined in iiiinnnnttttrrrroooo____sssshhhhmmmmeeeemmmm(3).
  149.  
  150.      All SHMEM collective routines reset the values in _p_S_y_n_c before they
  151.      return, so a particular _p_S_y_n_c buffer need only be initialized the
  152.      first time it is used.
  153.  
  154.      You must ensure that the _p_S_y_n_c array is not being updated on any PE in
  155.      the active set while any of the PEs participate in processing of a
  156.      SHMEM collective routine.  Be careful to avoid these situations:
  157.  
  158.      * If the _p_S_y_n_c array is initialized at run time, some type of
  159.        synchronization is needed to ensure that all PEs in the working set
  160.        have initialized _p_S_y_n_c before any of them enter a SHMEM routine
  161.        called with the _p_S_y_n_c synchronization array.
  162.  
  163.      * A _p_S_y_n_c array can be reused on a subsequent SHMEM collective routine
  164.        only if none of the PEs in the active set are still processing a
  165.        prior SHMEM collective routine call that used the same _p_S_y_n_c array.
  166.        In general, this may be ensured only by doing some type of
  167.        synchronization.  However, in the special case of SHMEM routines
  168.        being called with the same active set, you can allocate two _p_S_y_n_c
  169.        arrays and alternate between them on successive calls.
  170.  
  171.      The collective routines operate on active PE sets that have a
  172.      non-power-of-two _P_E__s_i_z_e with some performance degradation.  They
  173.      operate with no performance degradation when _n_l_o_n_g is a
  174.      non-power-of-two value.
  175.  
  176. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  177.      C/C++:
  178.  
  179.           for (i=0; i < _SHMEM_COLLECT_SYNC_SIZE; i++) {
  180.                   pSync[i] = _SHMEM_SYNC_VALUE;
  181.           }
  182.           shmem_barrier_all(); /* Wait for all PEs to initialize pSync */
  183.           shmem_collect32(target, source, 64, pe_start, logPE_stride,
  184.              pe_size, pSync);
  185.  
  186.      Fortran:
  187.  
  188.            INTEGER PSYNC(SHMEM_COLLECT_SYNC_SIZE)
  189.            DATA PSYNC /SHMEM_COLLECT_SYNC_SIZE*SHMEM_SYNC_VALUE/
  190.  
  191.            CALL SHMEM_COLLECT4(TARGET, SOURCE, 64, PE_START, LOGPE_STRIDE,
  192.           &  PE_SIZE, PSYNC)
  193.  
  194. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  195.      iiiinnnnttttrrrroooo____sssshhhhmmmmeeeemmmm(3)
  196.